<%@ page import="ar.com.hakasoft.utils.DateUtil" %>

<html>
<head>
<meta name="layout" content="mainApp" />
<g:javascript library="jquery"  /> 
<g:javascript library="egreso" />
</head>
<body>
	<script type="text/javascript">
		document.getElementById('nombreSeccion').innerHTML = "Egresos";
	</script>
    <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${egresoInstance}">
    <div class="errors">
        <g:renderErrors bean="${egresoInstance}" as="list" />
    </div>
	</g:hasErrors>
	    <g:hasErrors bean="${egresoInstance}">
    <div class="errors">
        <g:renderErrors bean="${egresoInstance}" as="list" />
    </div>
	</g:hasErrors>
 	<g:uploadForm name="form" action="guardar" controller="egreso" >
 	
 		<g:hiddenField name="id" value="${egresoInstance.id}" />
 		
	    <div class="dialog" style="margin-left: 250px; border: 1px solid #ccc; width: 400px; align: center;">
	     		
	     	<g:if test="${egresoInstance.id }">
		     	<div style="padding: 5px 0; text-align: left; padding-left: 20px;">
		      		<table style="width: 100%; border: 0px;" cellpadding="0" cellspacing="0"><tr>
		      		<td width="160"><label>Egreso n&uacute;mero</label></td>
		      		<td><B>${egresoInstance.id }</B></td>
	           		</tr></table>
		      	</div>	
	      	</g:if>
	     		
	      	<div style="padding: 5px 0; text-align: left; padding-left: 20px;">
	      		<table style="width: 100%; border: 0px;" cellpadding="0" cellspacing="0"><tr>
	      		<td width="160"><label for="fecha"><g:message code="egreso.fecha.label" default="Fecha" /></label></td>
	      		<td>
	      			<g:textField name="inputDate"/>
	      			<g:hiddenField name="fechaHidden" id="fechaHidden" />
	      		</td>
           		</tr></table>
	      	</div>
	      	
      		<div style="padding: 5px 0; text-align: left; padding-left: 20px;">
	      		<table style="width: 100%; border: 0px;" cellpadding="0" cellspacing="0"><tr>
	      		<td width="160"><label>Producto</label></td>
	      		<td><g:textField name="producto" value="${egresoInstance?.producto}" maxLenght="255" /> </td>
           		</tr></table>
	      	</div>
	      	
      		<div style="padding: 5px 0; text-align: left; padding-left: 20px;">
                <table style="width: 100%; border: 0px;" cellpadding="0" cellspacing="0"><tr>
	      		<td width="160"><label for="total"><g:message code="egreso.total.label" default="Total" /></label></td>
	           	<td><g:textField name="total" onkeypress="soloNumeros(event,true)" value="${fieldValue(bean: egresoInstance, field: 'total').replace(',','.')}" /></td>
           		</tr></table>
           </div>

	    </div>
	    <br><br>
	    <div align="center">
	    
<%--	    	<g:actionSubmit value="Guardar" action="guardar" onClick="if(!validar()) return false"  />--%>
	    	
	    	<g:submitToRemote name="guardar" value="Guardar" before="if(!validar()) return false"
	    	 onLoading="showSpinner('spinner', true);" onComplete="showSpinner('spinner', false); limpiarTrasIngreso();"
	    	update="tablaEgresos" action="agregarEgreso" />
	    	
<%--	    	<g:if test="${!egresoInstance.id }">--%>
<%--	    	 	<g:actionSubmit name="nuevo" onclick="if(!confirm('Desea crear un nuevo egreso?')) return false"--%>
<%--		    	 value="Nuevo" action="nuevoEgreso"  />--%>
<%--	    	</g:if>--%>
	    	
		    <g:actionSubmit name="Finalizar" onclick="if(!confirm('Desea finalizar el egreso?')) return false"
		    	 value="Finalizar" action="finalizar"  />
	    </div>
    	
    	<div style="margin-top: 20px;" id="tablaEgresos"></div>
    	
	</g:uploadForm>

</body>
</html>